import httpInstance from '@/utils/https.js'

// 用户信息
export const userRegisterApi = (data) => {
    return httpInstance({
        url: '/user/reg',
        method: 'POST',
        data
    })
}

// 根据ID获取用户信息
export const getUserByIdApi = (params) => {
    return httpInstance({
        url: `/user/id`,
        method: 'GET',
        params
    })
}

// 登录
export const userLoginApi = (data) => {
    return httpInstance({
        url: '/user/login',
        method: 'POST',
        data
    })
}

export const getOpenIdApi = (params) => {
    return httpInstance({
        url: 'https://api.weixin.qq.com/sns/jscode2session',
        method: 'GET',
        params: {
            appid: params.appid,
            secret: params.secret,
            js_code: params.code,
            grant_type: 'authorization_code'
        }
    })
}

export const forgetApi = (data) => {
    return httpInstance({
        url: '/user/forget',
        method: 'POST',
        data
    })
}

// 获取用户画像
export const wordCloudApi = (userId) => {
    return httpInstance({
        url: `http://127.0.0.1:6999/change/wordCloud/${userId}`,
        method: 'GET'
    })
}
